<template>
  <div class="memo-wrapper">
    <div class="more-box">
      <h5 class="title">便签</h5>
      <span class="more-btn" @click="router.push('/index/memo')">
        更多
        <var-icon name="chevron-right" class="more-icon" />
      </span>
    </div>
    <div class="memo-cont">
      <MobileCard
        v-for="item in menoListTop4Readonly"
        :key="item.id"
        :source="item"
        @click="router.push({path:'/memoEdit',query:{id:item.id}})"
      />
    </div>
  </div>
</template>
<script setup name="BookMark">
import { ref, inject, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import useSymbols from '../../compostions/useSymbols.js';
import MobileCard from '../../components/MobileCard/index.vue';

const { getMenoDataListTop4, menoListTop4Readonly } = inject(useSymbols);

const router = useRouter();

onMounted(() => {
  getMenoDataListTop4();
});
</script>
<style scoped lang="less">
.memo-wrapper {
  width: 100%;
  background-color: #fff;
  margin-top: 0.5rem;
  .more-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.5rem 0.5rem 0.5rem;
    .title {
      font-size: .9rem;
      font-weight: 400;
      color: #343434;
      margin: 0;
      position: relative;
      padding-left: 0.5rem;
      &::before {
        width: 0.4rem;
        height: .9rem;
        border-radius: 0.2rem;
        background-color: var(--system-primary-color);
        position: absolute;
        top: calc(50% - 0.45rem);
        left: 0;
        content: '';
      }
    }
    .more-btn {
      display: flex;
      align-items: center;
      color: #999;
      font-size: .9rem;
      .more-icon {
        font-size: 1.4rem;
        margin-left: -0.3rem;
      }
    }
  }
  .memo-cont {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-column-gap: 0.5rem;
    grid-row-gap: 0.5rem;
    flex-wrap: nowrap;
    padding: 0.2rem 0.5rem 1rem 0.5rem;
    box-sizing: border-box;
  }
}
</style>
